<form id="formEdit" action="save" class="form-horizontal" role="form">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title" id="myModalLabel">操作</h4>
			</div>
			<div class="modal-body">

				<!-- 以下为要修改的的内容 -->

				<input type="hidden" name="id" data-th-value="${model.id}">
				<input type="hidden" name="teacher.id" data-th-value="${user.id}">

				<div class="form-group">
					<label for="txt_kcmc" class="col-sm-2 control-label">课程</label>
					<div class="col-sm-5">
						<input th:if="${model.id!=null}" type="text" class="form-control"
							name="curriculum" th:value="${model.curriculum}"
							readonly="readonly">  <select
							th:if="${model.id==null}" id="curriculum" class="form-control"
							data-live-search="true" data-style="btn-primary"
							name="curriculum">
							<option th:each="k:${list}" th:text="${k.kcmc}" th:value="${k.kcmc}"></option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label for="txt_teacher" class="col-sm-2 control-label">老师</label>
					<div class="col-sm-9">
						<input type="text" name="teacher.name" data-th-value=${user.name}
							class="form-control" id="teacher" readonly="readonly">
						<input type="hidden" name="teacher.id" data-th-value=${user.id}
							class="form-control" id="teacher" readonly="readonly">
					</div>
				</div>
				<div class="form-group">
					<label for="txt_xq" class="col-sm-2 control-label">学期</label>
					<div class="col-sm-9">
						<input type="text" name="xq"
							data-th-value=${model.xq==null?xq:model.xq} class="form-control"
							id="xq" placeholder="学期">
					</div>
				</div>
				<div class="form-group">
					<label for="txt_zc" class="col-sm-2 control-label">周次</label>
					<div class="col-sm-9">
						<input type="text" name="zc" data-th-value=${model.zc}
							class="form-control" id="zc" placeholder="周次">
					</div>
				</div>
				<div class="form-group">
					<label for="txt_classes" class="col-sm-2 control-label">课次</label>
					<div class="col-sm-9">
						<input type="text" name="classes" data-th-value=${model.classes}
							class="form-control" id="classes" placeholder="课次">
					</div>
				</div>
				<div class="form-group">
					<label for="txt_content" class="col-sm-2 control-label">上课内容</label>
					<div class="col-sm-9">
						<input type="text" name="content" data-th-value=${model.content}
							class="form-control" id="content" placeholder="上课内容">
					</div>
				</div>


				<!-- 以上为要修改的内容 -->

			</div>
			<div class="modal-footer">
				<button type="submit" class="btn btn-primary">
					<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存
				</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">
					<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭
				</button>
			</div>
		</div>
	</div>
</form>
<script type="text/javascript" th:inline="javascript">
	var options = {
		message : '验证不通过',
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		fields : {

			content : {
				validators : {
					notEmpty : {
						message : '上课内容不能为空'
					}
				}
			},
			xq : {
				validators : {
					notEmpty : {
						message : '学期不能为空'
					}
				}
			},
			zc : {
				validators : {
					notEmpty : {
						message : '周次不能为空'
					}
				}
			},
			classes : {
				validators : {
					notEmpty : {
						message : '课次不能为空'
					}
				}
			}

		}
	};
	$('#formEdit').bootstrapValidator(options).on('success.form.bv',
			function(e) {
				e.preventDefault(); //很重要没有它则会提交默认表单，不会做下面的ajax表单提交
				var fd = new FormData($("#formEdit")[0]);
				$.ajax({
					url : "save",
					type : "POST",
					data : fd,
					processData : false, // 不处理数据  
					contentType : false, // 不设置内容类型
					success : function(result) {
						if (result.success) {
							$('#myModal').modal("hide");
						} else {
							bootbox.alert(result.msg);
						}
					},
					error : function(result) {
						alert(result);
					}
				});
			});
</script>